<?php
namespace Admin\Controller;
use Think\Controller;
class IndexController extends CommonController {
	/**
	 * 首页
	 * @internal 系统首页
	 * @access public
	 * @since 2014-10-10 14:53:37
	 * @author FrankKung <kongfanjian@andlisoft.com>
	 */
	public function index() {
		// 模型
		$Group	= D("Group");
		$Node	= D("Node");

		// 分组菜单
		$groupsMap['status'] = 1;
		$groups = M("Group")->where($groupsMap)->order("sort desc,id desc")->select();	
		$this->assign("groups",$groups);


		// 菜单项
		$id = $Node->getField('id');
		
		$map['status'] = 1;
		$map['pid'] = $id;
		$list = $Node->where($map)->select();//echo"<!--\r\n";var_dump($id,$list,$Node);echo "-->";
		$accessList = session('_ACCESS_LIST');
		$module['name'] = MODULE_NAME;
		foreach ($list as $key => $module) {
			if (1) { // 判断权限
				//设置模块访问权限
				$module ['access'] = 1;
				//获取当前分类的module
				$menu[$module['group_id']] [$key] =$module;
			}
		}
		$this->assign( 'menu', $menu );
		
		C ( 'SHOW_RUN_TIME', false ); // 运行时间显示
		C ( 'SHOW_PAGE_TRACE', false );
		$this->display ();
	}
}
